#include "Common.h"

#include <iostream>
#include <algorithm>
#include <vector>

void PrintElement(Element& e)
{
	std::cout << e.GetName() << " : " << e.GetOpposite() << std::endl;
}

void ElementTest()
{
    Elements::ElementsPtr eList = Elements::GetInstance();
    
	eList->CreateElement("element1", "opposite1");
	eList->CreateElement("element2", "opposite2");
	eList->CreateElement("element3", "opposite3");
	eList->CreateElement("element4", "opposite4");
	eList->CreateElement("element5", "opposite5");
	eList->CreateElement("element6", "opposite6");
    
	Elements::element_cont_type elements = eList->GetElements();
    
	std::for_each(elements.begin(), elements.end(), PrintElement);
}

void PrintEffect(Effect& e)
{    
    Elements::ElementsPtr       pElements   = Elements::GetInstance();
    Elements::element_cont_type eList       = pElements->GetElements();
        
    std::cout << e.GetName() << " : " << e.GetDuration() << " : " << eList[e.GetElementId()].GetName() << std::endl;    
}

void EffectTest()
{
    Effects::EffectsPtr efList = Effects::GetInstance();
    
    efList->CreateEffect("effect1", 1, 0);
    efList->CreateEffect("effect2", 1, 1);
    efList->CreateEffect("effect3", 1, 2);
    efList->CreateEffect("effect4", 1, 3);
    
    Effects::effect_cont_type effects = efList->GetEffects();
    
    std::for_each(effects.begin(), effects.end(), PrintEffect);
}

int main(void)
{
    ElementTest();
    EffectTest();
    
	getchar();
    
	return 0;
}